<template>
  <div class="login">
    <div class="main">
      <div class="back" @click="back">＜</div>
      <img class="title" src="@/assets/images/user/user-title.png" alt />
      <div class="put">
        <van-form @submit="onSubmit">
          <div class="top inputbox">
            <img src="@/assets/images/user/user-mobile.png" alt />
            <van-field
              v-model="tel"
              name
              placeholder="请输入手机号"
              :rules="[{ required: true, message: '请填写手机号' }]"
              size="small"
              left-icon="#"
            />
          </div>
          <div class="bot inputbox">
            <img src="@/assets/images/user/user-pass.png" alt />
            <van-field
              v-model="password"
              type="password"
              name
              placeholder="请输入密码"
              :rules="[{ required: true, message: '请填写密码' }]"
              size="small"
              left-icon="#"
            />
          </div>

          <div style="margin: 16px;">
            <van-button round block type="info" native-type="submit">登录</van-button>
          </div>
        </van-form>
      </div>
      <div class="foot">
        <span>注册</span>
        <span>忘记密码</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      password: "",
      tel: ""
    };
  },
  computed: {},
  created() {
    // console.log(0)
  },
  mounted() {},
  methods: {
    onSubmit() {
      var obj = {
        pass: this.password,
        tel: this.tel
      };
      if (this.password != "" && this.tel != "") {
        localStorage.setItem("user", JSON.stringify(obj));
        this.$router.push("/user");
      }
    },
    back() {
      this.$router.push("/");
    }
  }
};
</script>
<style lang="scss" >
.van-cell__value--alone {
  margin-left: 36px;
}
.van-field__control {
  color: white;
}
.put {
  img {
    // float:left;
    position: absolute;
    width: 14px;
    height: 19px;
    z-index: 10;
  }
  .top,
  .bot {
    overflow: hidden;
    position: relative;
    img {
      left: 80px;
      top: 23px;
    }
  }
}
.van-button--info {
  border: none;
}
</style>
<style scoped lang="scss">
.van-button--round {
  margin: 0 auto;
  width: 254px;
  height: 40px;
  background: linear-gradient(
    150deg,
    rgba(242, 91, 134, 1) 0%,
    rgba(241, 172, 94, 1) 100%
  );
  box-shadow: 0px 4px 20px 0px rgba(0, 0, 0, 0.57);
  border-radius: 11px;
  margin-top: 68px;
}
.van-cell {
  margin: 0 auto;
  margin: 11px auto;
  width: 254px;
  height: 40px;
  background: rgba(51, 54, 61, 1);
  box-shadow: 0px 4px 20px 0px rgba(0, 0, 0, 0.2);
  border-radius: 11px;
  // color:rgba(255,255,255,1);
}
.login {
  position: relative;
  // overflow: hidden;
  width: 100%;
  height: 100%;
  background: rgba(35, 38, 45, 1);
  .title {
    width: 103px;
    height: 92px;
    margin: 135px auto 33px;
  }
  .foot {
    display: flex;
    justify-content: space-between;
    margin: 15px auto;
    width: 254px;
    height: 14px;
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: rgba(255, 255, 255, 1);
    line-height: 14px;
  }
  .back {
    position: absolute;
    width: 20px;
    height: 20px;
    text-align: center;
    line-height: 20px;
    color: grey;
    top: 45px;
    left: 24px;
    font-size: 30px;
  }
}
</style>
